package com.zyht.website.shiro;

import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletResponse;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.apache.shiro.web.filter.PathMatchingFilter;

public class SysUserFilter extends PathMatchingFilter {

    @Override
    protected boolean onPreHandle(ServletRequest request, ServletResponse response, Object mappedValue) throws Exception {
    	Subject s = SecurityUtils.getSubject();
    	if(!s.isAuthenticated()){
    		((HttpServletResponse)response).sendRedirect("/anno/error");
    		 return false;
    	}
        return true;
    }
}
